<?php
/**
 * Klasse zum erstellen eines Listeneintrags
 *
 * @author		Joachim Ruf, Loresoft Software (http://www.loresoft.de)
 * @license		New BSD License
 * @version		Class for Bootstrap v2.3.2
 *
 * */


Class Bootstrap_List_Entry
{
	private $arrList			= array();
	private $arrParam			= array();
	private $content			= NULL;


	/**
	 * @param string $_size		: breite {1-12}
	 * @param string $_content	: Auszugebender Content
	 * */
	function __construct ($_content = NULL, array $_arrParam) {
		$this->content	= $_content;
		$this->arrParam	= $_arrParam;
	}


	private function getParameter (array $_arrParam) {
		$result	= NULL;

		if (count($_arrParam)) {
			foreach ($_arrParam as $key => $val) {
				$result	.= ' '.$key.'="'.$val.'"';
			}
		}

		return $result;
	}


	/**
	 * Liefert den Content zurueck
	 * @return int
	 * */
	public function getContent() {
		return $this->content;
	}


	/**
	 * Erstellt eine Subliste
	 * @return Bootstrap_List_Ordered_Handler
	 * */
	public function addOrderedHandler($_class = NULL) {
		return $this->arrList[]	= new Bootstrap_List_Ordered_Handler($_class);
	}


	/**
	 * Erstellt eine Subliste
	 * @return Bootstrap_List_Unordered_Handler
	 * */
	public function addUnorderedHandler($_class = NULL) {
		return $this->arrList[]	= new Bootstrap_List_Unordered_Handler($_class);
	}


	/**
	 * @desc Gibt ein Grid-Column aus.
	 * @return string
	 * */
	public function display() {
		$result	= NULL;

		if (count($this->arrList)) {
			/* @var $oObject Bootsrtap_List_Ordered_Handler */
			foreach ($this->arrList as $Key => $oObject) {
				$result	.= $oObject->display();
			}
		}

		return '<li'.$this->getParameter($this->arrParam).'>'.$this->content.$result.'</li>';
	}


}


?>